#include <iostream>
#include <string>
#include <map> 
#include <utility>
#include <algorithm>
using namespace std;
struct Display {
    void operator()(pair<string,double> info) {
        cout << info.first << " "
		     << info.second<< ";";
    }
};
int main()
{
    map<string, double> StudentScore;
    StudentScore["zhangsan"] = 95.0;
    StudentScore["lisi"] = 80.0;
    StudentScore.insert(map<string, double>::value_type("wangwu", 88.5));
    for (const auto& stu : StudentScore) {
        cout << "name: " << stu.first 
		     << " scores: " << stu.second << endl;
    }
    for_each(StudentScore.begin(), StudentScore.end(), Display());
    cout << endl;
    map<string, double>::iterator it;
    it = StudentScore.find("wangwu");
    if (it != StudentScore.end()) {
        cout << (it->second) << endl;
    }else {
        cout << "not found" << endl;
    }
    for (it = StudentScore.begin(); it != StudentScore.end(); ++it) {
        if (it->second < 90.0) {
            it = StudentScore.erase(it);
        }
    }
    for_each(StudentScore.begin(), StudentScore.end(), Display());
    cout << endl;
    StudentScore.erase(it);
    for_each(StudentScore.begin(), StudentScore.end(), Display());
    cout << endl;
}/*
int main()
{
    map<string, size_t> w_count;
    string word;
    while (cin >> word) {
    	if(word=="000")
    	     break;
        ++w_count[word];
    }
    for (const auto& w : w_count) {
        cout << w.first << " occurs: " 
		     << w.second << ((w.second > 1) ? " times" : " time") 
			 << endl;
    }
}*/
